package com.kinghood.gateway.common.config;

import feign.codec.Decoder;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.support.SpringDecoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.config.EnableWebFlux;
import org.springframework.web.reactive.config.WebFluxConfigurer;

/**
 * description
 *
 * @author zhangFanJun
 * @date 2024-01-19 18:43
 **/
@Configuration
@EnableWebFlux
@EnableFeignClients
public class WebClientConfiguration implements WebFluxConfigurer {

//    @Bean
//    public Decoder springDecoder() {
//        return new Jackson2JsonDecoder();
//    }
//
//    @Bean
//    public WebClient.Builder webClientBuilder(Decoder decoder) {
//        return WebClient.builder()
//                .exchangeStrategies(ExchangeStrategies.builder()
//                        .codecs(configurer -> configurer.defaultCodecs().jackson2JsonDecoder(decoder))
//                        .build());
//    }

//    @Bean
//    public Decoder feignDecoder() {
//        return new SpringDecoder(feignHttpMessageConverter());
//    }
//
//    @Bean
//    public ObjectFactory<HttpMessageConverters> feignHttpMessageConverter() {
//        return () -> new HttpMessageConverters();
//    }
//
//    @Bean
//    public WebReactiveFeign.Builder feignBuilder() {
//        return WebReactiveFeign.builder();
//    }
}
